dnl Process this file with autoconf to produce a configure script.
dnl

AC_INIT
#AC_CONFIG_SRCDIR([acinclude.m4])
AM_INIT_AUTOMAKE(i3, 0.2)
AC_CONFIG_HEADERS([config.h])


dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX

AC_CANONICAL_HOST

AC_PROG_INSTALL
AC_PROG_LN_S


#AM_DISABLE_SHARED
AM_ENABLE_SHARED
test -z "$target" && target=NONE
AM_PROG_LIBTOOL
dnl AC_PROG_RANLIB

dnl make sure that gcc 2.96 users use a different version of gcc
GCC_296_WORKAROUND

dnl check xml2 installation
AC_CHECK_PROG(XML2_CONFIG, xml2-config, yes, no)

if test x$XML2_CONFIG = xno
then
	AC_MSG_ERROR("Could not find xml2-config. libxml2 must be installed.")
fi

AC_CHECK_HEADERS(linux/if_tun.h)

AC_MSG_CHECKING("XML2 libs")
XML2_LIBS=`xml2-config --libs`
LIBS="$LIBS $XML2_LIBS"
AC_MSG_RESULT(yes)

AC_MSG_CHECKING("XML2 cflags")
XML2_CFLAGS=`xml2-config --cflags`
CFLAGS="$CFLAGS $XML2_CFLAGS"
CPPFLAGS="-I/usr/include/kerberos -I/usr/kerberos/include $CPPFLAGS $XML2_CFLAGS"
AC_MSG_RESULT(yes)


# Should we compile the OCD
AM_CONDITIONAL(COMPILE_OCD, false)
AC_ARG_ENABLE(compileOCD,
[  --enable-compileOCD        compile OCD.  [default=yes]],enable_compileOCD=$enableval,enable_compileOCD=yes)

if test "x$enable_compileOCD" = "xyes" ; then
    AM_CONDITIONAL(COMPILE_OCD, true)
fi



# Check for OS specific stuff
AM_CONDITIONAL(USE_CYGWIN, false)
case "$host" in
    *-*-cygwin*)
    AM_CONDITIONAL(USE_CYGWIN, true)
    ;;
esac

XML_VERSION=2.6.6
AM_PATH_XML2($XML_VERSION,,AC_MSG_ERROR([*** LibXML version $XML_VERSION
            not found!]))


ETAGS_ARGS='-C /dev/null'
AC_SUBST(ETAGS_ARGS)



AC_CONFIG_FILES([Makefile
	  i3/Makefile
	  i3_client/Makefile
	  aeshash/Makefile
	  utils/Makefile
	  examples/Makefile
      chord/Makefile
      i3_server/Makefile
	  i3OCD/Makefile
	  ])
AC_OUTPUT

